<%@ page contentType="text/html; charset=utf-8" language="java"
	import="java.sql.*" errorPage=""%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page isELIgnored="false"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript"></script>
<script type="text/javascript">
	jQuery(function($) {
		$(function gettopicState() {
			$
					.ajax({
						type : "post",
						url : "GetTopicStateServlet",
						data : "",
						dateType : "json",
						success : function(data) {
							var jsondata = eval('(' + data + ')');
							var topicToolsNode = $("#topic_tools");
							stateArray = jsondata.topicstate;
							for (var i = 0; i < stateArray.length; i++) {
								topicToolsNode
										.append("<span class=\"pipe\">|</span>");
								topicToolsNode
										.append("<a id=\"magt_d"+stateArray[i].ID+"\"  onclick=\"ManagerControl('"+ stateArray[i].Name +"','"+stateArray[i].ID+"')\" href=\"javascript:;\">"
												+ stateArray[i].Name + "</a>");
							}
						},
						error : function() {
							// TODO do something
						}
					});
		});
	});
</script>
<table class="fwin" cellspacing="0" cellpadding="0">
	<tbody>
		<tr>
			<td class="t_l"></td>
			<td class="t_c"></td>
			<td class="t_r"></td>
		</tr>
		<tr>
			<td class="m_l"></td>
			<td class="m_c">
				<div class="f_c">
					<div id="topic_tools" class="c">
						<h3>
							选中<strong id="mdct" class="xi1"></strong> 篇：
						</h3>
						<a id="magt_c" onclick="ManagerControl('清空状态','-2')" href="javascript:;">清空状态</a> <span
							class="pipe">|</span> <a id="magt_d"
							onclick="ManagerControl('删除','-1')" href="javascript:;">删除</a> <a></a>
					</div>
				</div>
			</td>
			<td class="m_r"></td>
		</tr>
		<tr>
			<td class="b_l"></td>
			<td class="b_c"></td>
			<td class="b_r"></td>
		</tr>
	</tbody>
</table>
<script type="text/javascript">
function ManagerControl(Cname,CId){
	if(CId=='-2'||CId=='-1'){
		 if(confirm("将执行 "+Cname+ "，并且无法恢复。您确定吗？")){
			 window.stateFunc(valueArray,Cname,CId);
		 }
	}else{
		 if(confirm("确定要 "+Cname+" 操作吗？")){
			 window.stateFunc(valueArray,Cname,CId);
		 }
	}
	
}
jQuery(function($) {
	window.stateFunc=function(array,tyle,tyleID){
		$.ajax({
			type : "post",
			url : "SetTopicServlet",
			data : {"idArray":array,"tyle":tyle,"tyleID":tyleID},
			dateType : "json",
			success : function(data) {
				var jsondata = eval('(' + data + ')');
				if(jsondata.isSuccess=="true"){
					getTopic();
				}else{
					alert("操作失败！ 请重试...");
				}
			},
			error:function(data){
				
			}
		});
	}
});
</script>

